/**
 * KopsoxApplicationServices
 * Copyright (C) 2010 Free Software Foundation, Inc. <http://fsf.org/>
 * 
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Lesser General Public License for more details.
 * You should have received a copy of the GNU Lesser General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
package org.kopsox.services.security;

import java.io.Serializable;
import java.security.Principal;
import java.util.Set;

/**
 * This interface extends the java.security.Principal interface with some 'Role'-functionality
 * 
 * @author Konrad Renner
 *
 */
public interface KopsoxPrincipal extends Principal, Serializable {

	/**
	 * Checks if the user has the given role
	 * 
	 * @param role
	 * @return boolean
	 * @author rpri182 - RenK
	 */
	public boolean hasRole(Role role);
	
	/**
	 * Gets the physical/real name of the user
	 * 
	 * @return String
	 * @author rpri182 - RenK
	 */
	public String getPhysicalName();
	
	/**
	 * Adds a role. Returns true if the role is added
	 * 
	 * @param role
	 * @return boolean
	 * @author rpri182 - RenK
	 */
	public boolean addRole(Role role);
	
	/**
	 * Adds roles. Returns true if the roles are added
	 * 
	 * @param roles
	 * @return boolean
	 * @author rpri182 - RenK
	 */
	public boolean addRoles(Set<Role> roles);
	
	/**
	 * Removes a role. Returns true if the role is removed
	 * 
	 * @param role
	 * @return boolean
	 * @author rpri182 - RenK
	 */
	public boolean removeRole(Role role);
	
	/**
	 * Removes roles. Returns true if the roles are removed
	 * 
	 * @param roles
	 * @return boolean
	 * @author rpri182 - RenK
	 */
	public boolean removeRoles(Set<Role> roles);
}
